package cn.xd.itstack.springframework.beans.bean;

import java.util.HashMap;
import java.util.Map;

/**
 * @Classname UserDao
 * @Description TODO
 * @Date 2022/5/12 下午5:53
 * @Created by lvxiaodong
 */
public class UserDao {

    private static Map<Integer,String> hashMap =new HashMap<>();


    public void initialize(){
        System.out.println("执行：init-method");
        hashMap.put(1,"小红");
        hashMap.put(2,"小明");
        hashMap.put(3,"小张");
    }

    public void destroy(){
        System.out.println("执行：destroy-method");
        hashMap.clear();
    }

    public String getUserId(Integer userId){

        return hashMap.get(userId);
    }
}
